#!/user/bin/env python3
# -*- coding: utf-8 -*-
"""
--------------------------------------
    Author:     JiChao_Song
    Date  :     2022/1/12 13:23
    Desc  :
--------------------------------------
"""
from apps import AbstractBaseModel
from django.db import models

from common.enums.config_enums import DatabaseTypeEnums


class DatabaseConfig(AbstractBaseModel):
    """数据库配置表"""

    name = models.CharField(max_length = 255, help_text = '数据库名称')
    dbType = models.IntegerField(default = DatabaseTypeEnums.MYSQL.key, help_text = '数据类型')
    host = models.CharField(max_length = 255, help_text = '数据库地址')
    port = models.IntegerField(help_text = '端口')
    userName = models.CharField(max_length = 255, help_text = '用户名')
    password = models.CharField(max_length = 255, help_text = '密码')
    database = models.CharField(max_length = 255, help_text = '数据库')

    class Meta:
        verbose_name = 'DatabaseConfig'
        verbose_name_plural = verbose_name
        db_table = 'tDatabaseConfig'
        ordering = ['-createTime']